package com.ruoyi.petSys.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.petSys.entity.vo.AddFriendVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.petSys.mapper.AddFriendMapper;
import com.ruoyi.petSys.domain.AddFriend;
import com.ruoyi.petSys.service.IAddFriendService;

/**
 * 添加好友Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-15
 */
@Service
public class AddFriendServiceImpl implements IAddFriendService 
{
    @Autowired
    private AddFriendMapper addFriendMapper;

    /**
     * 查询添加好友
     * 
     * @param id 添加好友主键
     * @return 添加好友
     */
    @Override
    public AddFriendVo selectAddFriendById(Long id)
    {
        return addFriendMapper.selectAddFriendById(id);
    }

    /**
     * 查询添加好友列表
     * 
     * @param addFriend 添加好友
     * @return 添加好友
     */
    @Override
    public List<AddFriendVo> selectAddFriendList(AddFriend addFriend)
    {
        return addFriendMapper.selectAddFriendList(addFriend);
    }

    /**
     * 新增添加好友
     * 
     * @param addFriend 添加好友
     * @return 结果
     */
    @Override
    public int insertAddFriend(AddFriend addFriend)
    {
        addFriend.setCreateTime(DateUtils.getNowDate());
        return addFriendMapper.insertAddFriend(addFriend);
    }

    /**
     * 修改添加好友
     * 
     * @param addFriend 添加好友
     * @return 结果
     */
    @Override
    public int updateAddFriend(AddFriend addFriend)
    {
        addFriend.setUpdateTime(DateUtils.getNowDate());
        return addFriendMapper.updateAddFriend(addFriend);
    }

    @Override
    public int updateFriendApply(AddFriend addFriend){
        addFriend.setUpdateTime(DateUtils.getNowDate());
        return addFriendMapper.updateFriendApply(addFriend);
    }
    /**
     * 批量删除添加好友
     * 
     * @param ids 需要删除的添加好友主键
     * @return 结果
     */
    @Override
    public int deleteAddFriendByIds(Long[] ids)
    {
        return addFriendMapper.deleteAddFriendByIds(ids);
    }

    /**
     * 删除添加好友信息
     * 
     * @param id 添加好友主键
     * @return 结果
     */
    @Override
    public int deleteAddFriendById(Long id)
    {
        return addFriendMapper.deleteAddFriendById(id);
    }
}
